package com.orhon.smartcampus.modules.teacher.mm;

import java.util.List;

import org.mapstruct.InheritConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import com.orhon.smartcampus.modules.base.mm.DictionaryMapper;
import com.orhon.smartcampus.modules.base.mm.LangMapper;
import com.orhon.smartcampus.modules.teacher.entity.Passport;
import com.orhon.smartcampus.modules.teacher.gqlModel.GQLPassport;

@Mapper(
        uses={
                LangMapper.class,
                DictionaryMapper.class
        }
)
public interface PassportMapper {
    PassportMapper MAPPER = Mappers.getMapper(PassportMapper.class);
    @Mappings({
            @Mapping(source="id",target="id"),
            @Mapping(source="teacher_id",target="teacher_id"),
            @Mapping(source="school_id",target="school_id"),
            @Mapping(source="time",target="time"),
            @Mapping(source="entime",target="entime"),
            @Mapping(source="gender",target="gender", qualifiedByName = "str2dic"),
            @Mapping(source="nation",target="nation", qualifiedByName = "str2dic"),
            @Mapping(source="idcard",target="idcard"),
            @Mapping(source="passportnumber",target="passportnumber"),
            @Mapping(source="companyopinion",target="companyopinion"),
            @Mapping(source="companyopinionid",target="companyopinionid"),
            @Mapping(source="directorcompanyopinion",target="directorcompanyopinion"),
            @Mapping(source="directorcompanyopinionid",target="directorcompanyopinionid"),
            @Mapping(source="companyopinionimg",target="companyopinionimg"),
            @Mapping(source="directorcompanyopinionimg",target="directorcompanyopinionimg"),
            @Mapping(source="name",target="name"),
            @Mapping(source="sourceofcost",target="sourceofcost"),
            @Mapping(source="sourceofcostwa",target="sourceofcostwa"),
            @Mapping(source="reasonsabroad",target="reasonsabroad"),
            @Mapping(source="nationality",target="nationality"),
            @Mapping(source="createdBy",target="created_by"),
            @Mapping(source="updatedBy",target="updated_by"),
            @Mapping(source="createdAt",target="created_at"),
            @Mapping(source="updatedAt",target="updated_at"),
            @Mapping(source="deletedAt",target="deleted_at"),
    })
    GQLPassport mapEntity(Passport entity);
    @InheritConfiguration(name = "mapEntity")
    List<GQLPassport> mapEntityList(List<Passport> entities);
}
